package com.king.pattem.factory.simpleFactory.factory;

import com.king.pattem.factory.simpleFactory.car.ICar;
import com.king.pattem.factory.simpleFactory.car.impl.Benz;
import com.king.pattem.factory.simpleFactory.car.impl.Bmw;

/**
 *	Car工厂类 
 * @author taomk
 */
public class CarFactory {
	
	public static ICar buildCar(String carName)throws Exception{ 
		if(carName.equalsIgnoreCase("Benz"))
			return new Benz();
        else if(carName.equalsIgnoreCase("Bmw"))
			return new Bmw();
        else
			throw new Exception();
	}
	
}
